<!DOCTYPE html>
<html>
<head>
<#include "/common/freemarker/include_css.ftl">
<#include  "/app/common/uploadimage/attachment.ftl">
<title>活动奖品配置</title>
</head>
 

<body>
	<div class="panel panel-default">
	   <div class="panel-heading">
	       <div class="panel-title">活动奖品配置</div>
	   </div>
	   <div clas="panel-body">
	      <div class="row">
	           <div class="col-md-12">
			   <br>
                
                      
                    <div id="listDiv">
                        <#--
	                    <#include  "/app/ued/event/eventprize2/list.ftl"/>
	                    -->
                    </div>
                    <div class="col-md-12">
                     
                    	<hr>
                    </div>  
                    <div id="editDiv" style="display:none">
                        <#assign readOnly=false>
	                    <#include  "editSub.ftl"/>
                    </div>
             	 
	           
                 
	        </div>
	    </div>
	</div>
	<#--  公共js -->
	<#include "/common/freemarker/include_js.ftl">
 
	 <script >
	   function listSub(){
	    	   
	 		  $.ajax({
		         type:"GET",
		         url: "<@context/>ued/eventprize2/listSub.do?mainUuid=${param["mainUuid"]}",
		         data:{},
		         cache: false,
		         success: function(html){
		        	   $("#listDiv").html(html);
		         }
	 		 });
	   }
	   
	   $(document).ready(function(){
	   		listSub();
	   })	
 	   function doAdd(){
 	   		editSub("");
 	   }
	   function saveSub(){
	    	  var mData = $("#subForm").serialize();
	 		  $.ajax({
		         type:"POST",
		         url: "<@context/>ued/eventprize2/saveSub.do?mainUuid=${param["mainUuid"]}",
		         data:mData,
		         cache: false,
		         success: function(html){
		        	    $("#listDiv").html(html);
			 	   		$(".subData").each(function(){
			 	   			$(this).val("");
			 	   		})		        	   
		          }
	 		 });
	    }
	    
	    function deleteSub(subUuid){
	    	  if (confirm("确定要删除吗？")==false){
	    	  	  return;
	    	  }
	    	  var mData={"subUuid":subUuid };
	 		  $.ajax({
		         type:"POST",
		         url: "<@context/>ued/eventprize2/deleteSub.do?mainUuid=${param['mainUuid']}",
		         data:mData,
		         dataType:"html",
		         cache: false,
		         success: function(html){
		        	   $("#listDiv").html(html);
		          }
	 		 });
	    }
	    
	    function editSub(subUuid){
 
			  var mData={"subUuid":subUuid };
	 		  $.ajax({
		         type:"GET",
		         url: "<@context/>ued/eventprize2/editSub.do?mainUuid= ${param ['mainUuid']}",
		         data:mData,
		         dataType:"html",
		         cache: false,
		         success: function(html){
		              $("#editDiv").html(html);
		              $("#editDiv").show();
		          }
	 		 });
	    }
	    
	</script>
</body>
</html>
 

